{extend name="public/base" /}

{block name="title"}<title>{$Think.lang.list}</title>{/block}

{block name="pjax_container"}
<section class="content-header">
    <h1>用户列表</h1>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> 用户列表</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header with-border">
                    {include file="public/top_action" /}
                    {include file="public/search" /}
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-bordered table-hover table-sort">
                        <tr>
                            <th width="35"><input type="checkbox" class="minimal checkbox-toggle"></th>
                            <th>ID</th>
                            <th>会员昵称</th>
                            <th>联系电话</th>
                            <th>注册时间</th>
                            <th>登录IP</th>
                            <th>登录次数</th>
                            <th>账号状态</th>
                            <th>账号类型</th>
                            <th >成交</th>
                            <th width="204">{$Think.lang.action}</th>
                        </tr>
                        {volist name="dataList" id="vo"}
                        <tr>
                            <td style="vertical-align:middle"><input type="checkbox" name="id[]" value="{$vo.id}" class="minimal"></td>
                            <td style="vertical-align:middle">{$vo.id}</td>
                            <!-- <td style="vertical-align:middle"><img src="{$vo->userInfo->avatar}" style="width:50px;border-radius:50%;" /></td> -->
                         <!--    <td style="vertical-align:middle">
                                {$vo.username}
                                {volist name="vo.userGroup" id="vo2"}
                                <span class="label" style="background:{$vo2.pic}">{$vo2.title}</span>
                                {/volist}
                            </td> -->
                            <!-- <td style="vertical-align:middle"><span class="editable" data-pk="{$vo.id}" data-name="name" data-url="{:url(CONTROLLER_NAME.'/edit', 'id='.$vo['id'])}" >{$vo.name}</span></td> -->
                            <td style="vertical-align:middle">{$vo.nickname}</td>
                            <td style="vertical-align:middle">{$vo.telphone}</td>
                            <td style="vertical-align:middle">{$vo.create_time|date="Y-m-d H:i",###}</td>
                            <!-- <td style="vertical-align:middle">{$vo.update_time|date="Y-m-d H:i",###}</td> -->
                            <td style="vertical-align:middle">{$vo.login_ip}</td>
                            <td style="vertical-align:middle">{$vo.login_count}</td>
                            <td style="vertical-align:middle">
                              {if condition="($vo.status == 0)"}
                              <span class="btn btn-default btn-xs">正常</span>
                              {elseif condition="$vo.status eq 1"/}
                              <span class="btn btn-warning btn-xs">异常</span>
                              {elseif condition="$vo.status eq 2"/}
                              <span class="btn btn-info btn-xs">账号被锁定</span>
                              {else /}
                              <span class="btn btn-danger btn-xs">账号冻结</span>
                              {/if}
                            </td>
                            <td style="vertical-align:middle">
                              {eq name="$vo.type" value='0'}<span class="btn btn-info btn-xs">注册用户</span>{else/}<span class="btn btn-success btn-xs">商家用户</span>{/eq}
                            </td>

                            <td><label class="label label-primary">订单:0</label>
                            <br/><label class="label label-danger">金额: 0</label></td>

                            <td style="vertical-align:middle">
                                <div class="btn-group btn-group-sm" >
                                    <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="javascript:;">操作 <span class="caret"></span></a>
                                    <ul class="dropdown-menu dropdown-menu-left" role="menu" style='z-index: 9999'>

                                        <li><a href="{:url('cuser/details',array('id'=>$vo['id']))}" title="会员详情"><i class='fa fa-edit'></i> 会员详情</a></li>
                                        <li><a  href="{:url('cuser/cuserOrderList',array('id'=>$vo['id']))}" title='会员订单'><i class='fa fa-list'></i> 会员订单</a></li>

                                    </ul>
                                {include file="public/list_action" /}
                                </div>

                            </td>
                        </tr>
                        {/volist}
                    </table>
                </div>
                <div class="box-footer clearfix">
                    {$dataList->render()}
                </div>
            </div>
        </div>
    </div>
</section>
<script type="text/javascript">
$(function(){
    /*ajax页面加载icheck，有该控件的页面才需要*/
    $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
        checkboxClass: 'icheckbox_minimal-blue',
        radioClass: 'iradio_minimal-blue'
    });

    /*ajax页面加载icheck，有该控件的页面才需要*/
    $(".select2").select2({language:"zh-CN"});

    /*全选-反选*/
    $('.checkbox-toggle').on('ifChecked', function(event){
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("check");
    });
    $('.checkbox-toggle').on('ifUnchecked', function(event){
        var _this = $(this);
        var _table = _this.closest('.table');
        _table.find("tr td input[type='checkbox']").iCheck("uncheck");
    });

    $('.editable').editable({
        emptytext: "empty",
        params: function(params) {      //参数
            var data = {};
            data['id'] = params.pk;
            data[params.name] = params.value;
            return data;
        },
        success: function(response, newValue) {
            var res = $.parseJSON( response );
            if(res.status == 1){
            }else{
                return res.info;
            }
        }
    });

    {if condition=" $rest_login == 1 "}
    restlogin('{$rest_login_info}');   //登录超时
    {/if}
})
</script>
{/block}